sgdk
vdp_spr.h File Reference

VDP Sprite support. More...

Go to the source code of this file.

Classes

struct  SpriteDef

Defines

#define MAX_SPRITE   80
#define SPRITE_SIZE(w, h)   ((((w) - 1) << 2) | ((h) - 1))

Functions

void VDP_resetSprites ()
 Reset all sprites.
void VDP_setSprite (u16 index, s16 x, s16 y, u8 size, u16 tile_attr, u8 link)
 Set a sprite (use sprite list cache).
void VDP_setSpriteP (u16 index, const SpriteDef *sprite)
 Set a sprite (use sprite list cache).
void VDP_setSpriteDirect (u16 index, s16 x, s16 y, u8 size, u16 tile_attr, u8 link)
 Set a sprite (direct send to VDP).
void VDP_setSpriteDirectP (u16 index, const SpriteDef *sprite)
 Set a sprite (direct send to VDP).
void VDP_setSpritePosition (u16 index, s16 x, s16 y)
 Set sprite position (use sprite list cache).
void VDP_setSprites (u16 index, const SpriteDef *sprites, u16 num)
 Set severals sprites (use sprite list cache).
void VDP_setSpritesDirect (u16 index, const SpriteDef *sprites, u16 num)
 Set severals sprites (direct send to VDP).
void VDP_updateSprites ()
 Send the cached sprite list to the VDP.

Variables

SpriteDef vdpSpriteCache [MAX_SPRITE]
 VDP sprite definition cache.

Detailed Description

VDP Sprite support.

Author:
Stephane Dallongeville
Date:
08/2011

This unit provides methods to manipulate the VDP Sprites.
The Sega Genesis VDP can handle up to 80 simultanous sprites of 4x4 tiles (32x32 pixels).


Define Documentation

#define MAX_SPRITE   80

Maximum number of sprite

#define SPRITE_SIZE (   w,
 
)    ((((w) - 1) << 2) | ((h) - 1))

Helper to define sprite size in sprite definition structure.

Parameters:
wsprite width (in tile).
hsprite height (in tile).

Function Documentation

void VDP_resetSprites ( )

Reset all sprites.

Clear the sprite list.

void VDP_setSprite ( u16  index,
s16  x,
s16  y,
u8  size,
u16  tile_attr,
u8  link 
)

Set a sprite (use sprite list cache).

Parameters:
indexIndex of the sprite to set (should be < MAX_SPRITE).
xSprite position X.
ySprite position Y.
sizeSprite size (see SPRITE_SIZE() macro).
tile_attrSprite tile attributes (see TILE_ATTR_FULL() macro).
linkSprite link (index of next sprite, 0 for end).
void VDP_setSpriteDirect ( u16  index,
s16  x,
s16  y,
u8  size,
u16  tile_attr,
u8  link 
)

Set a sprite (direct send to VDP).

Parameters:
indexIndex of the sprite to set (should be < MAX_SPRITE).
xSprite position X.
ySprite position Y.
sizeSprite size (see SPRITE_SIZE() macro).
tile_attrSprite tile attributes (see TILE_ATTR_FULL() macro).
linkSprite link (index of next sprite, 0 for end).

See VDP_setSprite().

void VDP_setSpriteDirectP ( u16  index,
const SpriteDef sprite 
)

Set a sprite (direct send to VDP).

Parameters:
indexIndex of the sprite to set (should be < MAX_SPRITE).
spriteSprite definition.

See VDP_setSpriteP().

void VDP_setSpriteP ( u16  index,
const SpriteDef sprite 
)

Set a sprite (use sprite list cache).

Parameters:
indexIndex of the sprite to set (should be < MAX_SPRITE).
spriteSprite definition.

See VDP_setSprite().

void VDP_setSpritePosition ( u16  index,
s16  x,
s16  y 
)

Set sprite position (use sprite list cache).

Parameters:
indexIndex of the sprite to modify position (should be < MAX_SPRITE).
xSprite position X.
ySprite position Y.

See VDP_setSprite().

void VDP_setSprites ( u16  index,
const SpriteDef sprites,
u16  num 
)

Set severals sprites (use sprite list cache).

Parameters:
indexIndex of first sprite to set (should be < MAX_SPRITE).
spritesSprite definitions.
numNumber of sprite to set.

See VDP_setSpritesDirect().

void VDP_setSpritesDirect ( u16  index,
const SpriteDef sprites,
u16  num 
)

Set severals sprites (direct send to VDP).

Parameters:
indexIndex of first sprite to set.
spritesSprite definitions.
numNumber of sprite to set.

See VDP_setSprites().

void VDP_updateSprites ( )

Send the cached sprite list to the VDP.

You should call this method when you completed your sprite update task.

 All Classes Files Functions Variables Typedefs Enumerations Defines